<%@ Page Language="C#" MasterPageFile="~/Admin.master" AutoEventWireup="true" CodeFile="Topics.aspx.cs" Inherits="Topics" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="phMain" Runat="Server">
    <asp:GridView ID="gvTopics" runat="server" DataSourceID="dsTopics" AllowPaging="True" AutoGenerateColumns="False" DataKeyNames="Id,ConcurencyId" OnSelectedIndexChanged="gvTopics_SelectedIndexChanged" >
        <Columns>
            <acmswc:IndexField/>
            <asp:BoundField DataField="Id" HeaderText="Id" ReadOnly="True" SortExpression="Name" />
            <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
            <acmswc:SequenceField />
            <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" ShowSelectButton="True" SelectText="Attachments" />
        </Columns>
        <SelectedRowStyle BackColor="Yellow" />
    </asp:GridView>
    <fieldset>
        <legend>Insert New Topic</legend>
        <asp:DetailsView ID="dvTopics" DefaultMode="Insert" runat="server" AutoGenerateRows="False" DataSourceID="dsTopics" >
            <Fields>
                <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
                <asp:CommandField ShowInsertButton="True"/>
            </Fields>
        </asp:DetailsView>
    </fieldset>
    <div id="divAttachments" runat="server">
    <fieldset>
        <legend>Attachments</legend>
        <asp:GridView ID="gvAttachments" runat="server" AutoGenerateColumns="False" DataSourceID="dsAttachments" DataKeyNames="Id,TopicId,FileType,ConcurencyId">
            <Columns>
                <asp:BoundField DataField="Id" HeaderText="Id" ReadOnly="True" SortExpression="Id" />
                <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
                <asp:BoundField DataField="ContentType" HeaderText="ContentType" ReadOnly="True"
                    SortExpression="ContentType" />
                <asp:BoundField DataField="Size" HeaderText="Size" ReadOnly="True" SortExpression="Size" />
                <asp:HyperLinkField DataNavigateUrlFields="FileId" DataNavigateUrlFormatString="~/File.aspx?Id={0}"
                    Text="View" />
                <asp:CommandField ShowDeleteButton="True" />
            </Columns>
        </asp:GridView>
    </fieldset>
    <fieldset>
        <legend>Add New Attachment</legend>
        <asp:DetailsView ID="dvAttachments" runat="server" AutoGenerateRows="False" DataSourceID="dsAttachments"
            DefaultMode="Insert" Height="50px" Width="125px">
            <Fields>
                <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
                <asp:TemplateField HeaderText="Type">
                    <InsertItemTemplate>
                        <asp:DropDownList ID="dlFileType" runat="server" OnDataBinding="DropDownList1_DataBinding">
                        </asp:DropDownList>
                    </InsertItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="File">
                    <InsertItemTemplate>
                        <asp:FileUpload ID="fuAttachment" runat="server" />
                    </InsertItemTemplate>
                </asp:TemplateField>
                <asp:CommandField ShowInsertButton="true" ShowCancelButton="true" />
            </Fields>
        </asp:DetailsView>
    </fieldset>
    </div>
    <acmsdc:TopicDataSource ID="dsTopics" runat="server" OnSelectData="dsTopics_SelectData" OnUpdatingData="dsTopics_UpdatingData" OnBeforeUpdating="dsTopics_BeforeUpdating" />
    <acmsdc:TopicFileDataSource ID="dsAttachments" runat="server" EnablePaging="False" OnSelectData="dsAttachments_SelectData" OnUpdatingData="dsAttachments_UpdatingData" />
</asp:Content>

